<div class="think-box-shadow">
    <fieldset>
        <legend>操作</legend>
        <form action="{:sysuri()}" id="TagsDataSearch" autocomplete="off" class="layui-form layui-form-pane nowrap form-search" method="get" onsubmit="return false">


            <div class="layui-form-item layui-inline">
                <button class="layui-btn" data-title="添加进展" data-modal="{:url('add')}?zc_id={$zc_id}" type="button">
                    <i class="layui-icon">&#xe61f;</i> 添加进展
                </button>
            </div>

        </form>
    </fieldset>
    <table id="TagsData" data-url="{:sysuri()}" data-target-search="#TagsDataSearch"></table>
</div>

<script>
    $(function () {
        $('#TagsData').layTable({
            even: true, height: 'full',
            sort: {field: 'id desc', type: 'desc'},
            where: {zc_id: '{$zc_id}'},
            cols: [[
                // {field: 'id', title: 'ID', width: 80, align: 'center', sort: true},
                // {field: 'sort', title: '排序权重', width: 100, align: 'center', sort: true, templet: '#SortInputTagsDataTplModal'},
                // {field: 'chanpin_id', title: '产品名称', minWidth: 100},
                // {field: 'fenzu_id', title: '分组', minWidth: 100},
                {field: 'title', title: '进展', minWidth: 100},
                {field: 'fbdw', title: '发布单位', minWidth: 100},

                // {field: 'user_id', title: '用户ID', minWidth: 100},
                //  {field: 'status', title: '状态', width: 110, align: 'center', templet: '#StatusSwitchTagsDataTpl'},
                {field: 'create_at', title: '添加时间', minWidth: 170, align: 'center'},
                // {toolbar: '#ToolbarTagsData', title: '操作面板', minWidth: 100, align: 'center', fixed: 'right'},
            ]]
        });

        // 数据状态切换操作
        layui.form.on('switch(StatusSwitchTagsData)', function (obj) {
            var data = {id: obj.value, status: obj.elem.checked > 0 ? 1 : 0};
            $.form.load("{:url('state')}", data, 'post', function (ret) {
                if (ret.code < 1) $.msg.error(ret.info, 3, function () {
                    $('#TagsData').trigger('reload');
                });
                return false;
            }, false);
        });
    });
</script>

<!-- 数据状态切换模板 -->
<script type="text/html" id="StatusSwitchTagsDataTpl">
    <!--{if auth("state")}-->
    <input type="checkbox" value="{{d.id}}" lay-skin="switch" lay-text="已激活|已禁用" lay-filter="StatusSwitchTagsData" {{-d.status>0?'checked':''}}>
    <!--{else}-->
    {{-d.status ? '<b class="color-green">已激活</b>' : '<b class="color-red">已禁用</b>'}}
    <!--{/if}-->
</script>

<!-- 列表排序权重模板 -->
<script type="text/html" id="SortInputTagsDataTplModal">
    <input type="number" min="0" data-blur-number="0" data-action-blur="{:sysuri()}" data-value="id#{{d.id}};action#sort;sort#{value}" data-loading="false" value="{{d.sort}}" class="layui-input text-center">
</script>

<!-- 操控面板的模板 -->
<script type="text/html" id="ToolbarTagsData">

    <!--{if auth("edit")}-->
    <!--    <a class="layui-btn layui-btn-sm" data-title="编辑数据" data-modal='{:url("edit")}?id={{d.id}}&chanpin_id={{chanpin_id}}'>编 辑</a>-->
    <!--    <a class="layui-btn layui-btn-sm" data-title="编辑数据" data-modal='{:url("edit")}'  data-value="id#{{d.id}}">编 辑</a>-->
    <!--{/if}-->

    <!--{if auth("remove")}-->
    <!--    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除此吗？" data-action="{:url('remove')}" data-value="id#{{d.id}}">删 除</a>-->
    <!--{/if}-->
</script>